package com.test.designPattern.ch13;

/**
 * @ClassName ProxyImage
 * @Description 代理Image对象
 * @Author 维康
 * @Date 2018/6/11 14:58
 * @Version 1.0
 **/
public class ProxyImage implements Image {

    private RealImage realImage;
    private String fileName;

    public ProxyImage(String fileName){
        this.fileName = fileName;
    }

    @Override
    public void display() {
        if(realImage == null){
            realImage = new RealImage(fileName);
        }
        realImage.display();
    }
}
